package com.flashmoment.video.controller;

import java.util.Arrays;
import java.util.Map;

import com.flashmoment.video.utils.PageUtils;
import com.flashmoment.video.utils.R;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.flashmoment.video.entity.UserCollectEntity;
import com.flashmoment.video.service.UserCollectService;




/**
 * 用户收藏表
 *
 * @author xulu
 * @email 1435533194@qq.com
 * @date 2023-10-24 16:35:33
 */
@RestController
@RequestMapping("video/usercollect")
@CrossOrigin
@Api(tags = "用户收藏接口")

public class UserCollectController {
    @Autowired
    private UserCollectService userCollectService;

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody UserCollectEntity userCollect){
		userCollectService.save(userCollect);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody UserCollectEntity userCollect){
		userCollectService.updateById(userCollect);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody Integer[] ids){
		userCollectService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }
    @DeleteMapping("/deleteByVideoId/{ids}")
    public R deleteByVideoId(@PathVariable Integer[] ids){
        userCollectService.deleteBatch(Arrays.asList(ids));

        return R.ok();
    }

}
